const router = require('koa-router')({
  prefix: '/api', // 添加路由前缀
})

const controllers = require('../controllers/index')

// const Router = require('koa-router')
// const router = new Router()

const admin = require('../controllers/user/index');
const checkToken = require('../middleware/checkToken').admin()


router.get('/', (ctx, next) => {
  ctx.body = 'hello world'
})

// pure_admin START ---------------------------------------
// // 获取用户数据
router.post('/login', controllers.user.index.login)
router.get('/user/list', controllers.user.index.userList)

// router.get('/user/info', controllers.user.index.userInfo)
// router.post('/user/logout', controllers.user.index.logout)




// router.get('/book/list', controllers.article.index.getindex)
// // 获取漫画列表数据
// // router.get('/index', controllers.index.index)
router.get('/book/list', controllers.books.index.bookList)
router.post('/book/add', controllers.books.index.bookCreate)
router.post('/book/update', controllers.books.index.bookUpdate)
router.post('/book/delete', controllers.books.index.bookDelete)


// // 获取CPU列表数据
// // router.get('/index', controllers.index.index)
router.get('/cpu/list', controllers.cpu.index.cpuList)
router.post('/cpu/add', controllers.cpu.index.cpuCreate)
router.post('/cpu/update', controllers.cpu.index.cpuUpdate)
router.post('/cpu/delete', controllers.cpu.index.cpuDelete)


// // 获取日志数据
// // router.get('/index', controllers.index.index)
router.get('/releases', controllers.version.index.releases)
router.get('/ver/list', controllers.version.index.verList)
router.post('/ver/add', controllers.version.index.verCreate)
router.post('/ver/update', controllers.version.index.verUpdate)
router.post('/ver/delete', controllers.version.index.verDelete)


// // 获取日志数据
// // router.get('/index', controllers.index.index)
router.get('/card/list', controllers.card.index.cardList)
router.post('/card/add', controllers.card.index.cardCreate)
router.post('/card/update', controllers.card.index.cardUpdate)
router.post('/card/delete', controllers.card.index.cardDelete)

// // 获取套图
router.get('/pics/list', controllers.pics.index.picsList)
router.post('/pics/add', controllers.pics.index.picsCreate)
router.post('/pics/update', controllers.pics.index.picsUpdate)
router.post('/pics/delete', controllers.pics.index.picsDelete)

// // 获取视频
router.get('/video/getlabel', controllers.video.index.getLabel)
router.get('/video/list', controllers.video.index.videoList)
router.post('/video/add', controllers.video.index.videoCreate)
router.post('/video/update', controllers.video.index.videoUpdate)
router.post('/video/delete', controllers.video.index.videoDelete)

// // 获取AVMOO视频
router.get('/avmoo/list', controllers.avmoo.index.avmooList)
router.post('/avmoo/add', controllers.avmoo.index.avmooCreate)
router.post('/avmoo/addList', controllers.avmoo.index.avmooCreateList)
router.post('/avmoo/update', controllers.avmoo.index.avmooUpdate)
router.post('/avmoo/delete', controllers.avmoo.index.avmooDelete)

// // 获取role视频
router.post('/role', controllers.avmoo.index.roleList)
// pure_admin END ---------------------------------------




// // jindu start-------------------------------------------------------------------------------------
// // 文章数据
// router.get('/index/action', controllers.article.index.getindex)
// router.get('/article/list', controllers.article.index.getArtList)
// router.get('/article/detail', controllers.article.index.getArticle)
// router.get('/search/action', controllers.search.index.articleSearch)




// // 管理后台文章数据
// // router.get('/article/list', checkToken, controllers.article.index.getArticle)
// // // 管理后台添加文章数据
// // router.post('/article/create', checkToken, controllers.article.index.createContent)
// // // 管理后台更新文章数据
// // router.post('/article/update', checkToken, controllers.article.index.updateContent)

// // jindu end-------------------------------------------------------------------------------------

// // 留言板数据
// // router.get('/login', controllers.guestbook.index.login)
// router.get('/guestbook/list', controllers.guestbook.index.getGuestbook)
// router.get('/getopenid', controllers.guestbook.index.getOpenid)
// router.post('/guestbook/record', controllers.guestbook.index.recordGuestbook)


// // 公告数据
// router.get('/notice/list', controllers.notice.index.getNotice)
// router.post('/notice/create', checkToken, controllers.notice.index.createNotice)
// router.post('/notice/update', checkToken, controllers.notice.index.updateNotice)
// router.post('/notice/delete', checkToken, controllers.notice.index.deleteNotice)

// // 景点数据
// router.get('/scenic/list', controllers.scenic.index.getScenic)
// router.get('/scenic/detail', controllers.scenic.index.getDetail)


// // 搜索提示
// router.get('/search/searchaction', controllers.search.index.searchAction)


// // 首页数据
// router.get('/index', controllers.home.index)

// // posts文章数据
// router.get('/posts', controllers.posts.index.getPosts)


// // 获取登录数据
// router.post('/user/login', controllers.user.index.login)
// router.get('/user/info', controllers.user.index.userInfo)
// router.post('/user/logout', controllers.user.index.logout)

// // 获取/更新网站、管理员设置
// router.get('/setting/websetting', checkToken, controllers.setting.index.webSetting)
// router.post('/setting/websetting', checkToken, controllers.setting.index.webSetUpdate)
// router.get('/setting/user', checkToken, controllers.setting.index.getUser)
// router.post('/setting/user', checkToken, controllers.setting.index.updateUser)

// // banner横幅数据
// router.get('/setting/banner', checkToken, controllers.setting.banner.getBanner)
// router.post('/setting/addbanner', checkToken, controllers.setting.banner.addBanner)
// router.post('/setting/updatebanner', checkToken, controllers.setting.banner.updateBanner)
// router.post('/setting/delbanner', checkToken, controllers.setting.banner.delBanner)

// // 获取硬件列表数据
// router.get('/hardware/category', checkToken, controllers.hardware.index.hardwareCateList)
// router.post('/hardware/create', checkToken, controllers.hardware.index.hardwareCateCreate)
// router.post('/hardware/update', checkToken, controllers.hardware.index.hardwareCateUpdate)
// router.post('/hardware/delete', checkToken, controllers.hardware.index.hardwareCateDelete)

// // // 获取订单列表数据
// // router.get('/order/getorder', checkToken, controllers.order.index.getOrderList)
// // router.post('/hardware/create', checkToken, controllers.hardware.index.hardwareCateCreate)
// // router.post('/hardware/update', checkToken, controllers.hardware.index.hardwareCateUpdate)
// // router.post('/hardware/delete', checkToken, controllers.hardware.index.hardwareCateDelete)


// // 获取漫画列表数据
// // router.get('/index', controllers.index.index)
// router.get('/book/list', controllers.books.index.bookList)
// router.post('/book/create', controllers.books.index.bookCreate)
// router.post('/book/update', controllers.books.index.bookUpdate)
// router.post('/book/delete', controllers.books.index.bookDelete)


// // 获取分类数据
// router.get('/category', controllers.category.index.getCategory)
// router.get('/catedetail', controllers.category.index.getCatedetail)


// // 获取品牌数据
// router.get('/catebrands', controllers.category.index.getCatebrands)

// // // 获取交换流程数据
// router.get('/process', controllers.category.index.getProcess)


// // 获取用户地址
// router.get('/getaddress', controllers.address.index.getAddress)
// // 保存用户地址
// router.post('/saveaddress', controllers.address.index.saveAddress)

// // 订单数据
// router.post('/submitorder', controllers.order.index.submitOrder)
// router.get('/getorder', controllers.order.index.getOrder)
// router.post('/delorder', controllers.order.index.delOrder)

// // 管理后台订单数据
// router.get('/order/getorder', checkToken, controllers.order.index.getOrderList)
// router.post('/order/update', checkToken, controllers.order.index.orderUpdate)



// // 管理后台文章数据
// router.get('/info/posts', checkToken, controllers.posts.index.getInfoPosts)
// router.post('/info/update', checkToken, controllers.posts.index.infoUpdate)
// router.post('/info/add', checkToken, controllers.posts.index.infoAdd)
// router.post('/info/delete', checkToken, controllers.posts.index.infoDelete)

// // 管理后台文章数据
// router.get('/article/list', checkToken, controllers.article.index.getArticle)
// // 管理后台添加文章数据
// router.post('/article/create', checkToken, controllers.article.index.createContent)
// // 管理后台更新文章数据
// router.post('/article/update', checkToken, controllers.article.index.updateContent)



// // 管理后台 - 获取分类数据
// router.get('/category/list', checkToken, controllers.article.category.getCategory)
// // 管理后台 - 更新分类数据
// router.post('/category/update', checkToken, controllers.article.category.updateCategory)

// 管理后台 - 获取标签数据
// router.get('/article/tags', checkToken, controllers.article.tags.getTags)
// router.get('/article/changeStatus', checkToken, controllers.article.tags.changeStatus)

module.exports = router
